package com.tencent.wxcloudrun.controller;

import javax.annotation.Resource;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.tencent.wxcloudrun.config.ApiResponse;
import com.tencent.wxcloudrun.manager.OrderQueryManager;
import com.tencent.wxcloudrun.vo.request.order.OrderListReqVo;
import com.tencent.wxcloudrun.vo.request.order.OrderQueryReqVo;
import com.tencent.wxcloudrun.vo.response.order.OrderListResVo;
import com.tencent.wxcloudrun.vo.response.order.OrderQueryResVo;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;

/**
 * @Author ZhaoZiYin
 * @Date 2025/2/20
 * @Description 订单查询控制器
 */
@Api(tags = "订单查询控制器")
@Slf4j
@RestController
@Validated
@RequestMapping("/api/orderQuery")
public class OrderQueryController {

    @Resource
    private OrderQueryManager orderQueryManager;

    @ApiOperation("查询订单列表")
    @PostMapping(value = "/list")
    public ApiResponse<OrderListResVo> list(@RequestBody @Valid OrderListReqVo reqVo) {
        return ApiResponse.ok(orderQueryManager.list(reqVo));
    }

    @ApiOperation("查询订单详情")
    @PostMapping(value = "/query")
    public ApiResponse<OrderQueryResVo> query(@RequestBody @Valid OrderQueryReqVo reqVo) {
        return ApiResponse.ok(orderQueryManager.query(reqVo));
    }

}
